import request from '@/utils/request'
import type { IIndexDataParams, IIndexDataResult } from '@/api/index/types'

/**
 * 获取首页数据
 * @param {IIndexDataParams} params 请求参数
 */
export const requestIndexDataGet = (params: IIndexDataParams) => {
  return request<IIndexDataResult>({
    url: '/captchaImage',
    method: 'GET',
    params,
    isLoading: true,
    loadingText: '自定义加载~'
  })
}

/**
 * 获取首页数据
 * @param {IIndexDataParams} params 请求 query 参数
 * @param {Record<string, any>} data 请求 body 参数
 */
export const requestIndexDataPost = (params: IIndexDataParams, data: Record<string, any>) => {
  return request<IIndexDataResult>({
    url: '/test',
    method: 'POST',
    params,
    data
  })
}
